//
//  DoctorNetmanager.m
//  OnePointDemo
//
//  Created by 薛磊 on 2018/7/9.
//  Copyright © 2018年 XL. All rights reserved.
//

#import "DoctorNetmanager.h"

@implementation DoctorNetmanager
//MARK: - POST
+ (void)postForQuiesceRequestWithInterface:(NSString*)interface params:(NSMutableDictionary *)params kSuccessBlock kErrorBlock{
    return[self postWithDomainName:kPortNumber interface:interface params:params successBlock:successBlock errorBlock:errorBlock];
}

+ (void)postWithDomainName:(NSString*)domainName interface:(NSString*)interface params:(NSMutableDictionary *)params kSuccessBlock kErrorBlock{
    
    if (params == nil) params = [NSMutableDictionary dictionary];
    
    if ([params isKindOfClass:[NSDictionary class]]) params = [NSMutableDictionary dictionaryWithDictionary:params];

    NSString * urlStr = [NSString stringWithFormat:@"%@%@",domainName,interface?:@""];
    
    [self POST:urlStr params:params completionHandle:^(id response, NSError *error) {
        
        NSLog(@"\n\n\nPOST-服务器响应%@：\n域名：%@ \n参数：%@ \n响应信息：%@\n\n\n",error?@"失败":@"成功",urlStr, params, response);
        
        if (error){//处理服务器响应失败结果
            
        }else{//处理服务器响应成功结果
           
            if(successBlock){
                successBlock(response);
            }
            
        }
        
    }];
    
}
@end
